#include<stdio.h>
#include<string.h>
#include<unistd.h>
#include<sys/shm.h>
#include<sys/ipc.h>

#define pathname "./server.cpp"
#define number 0x66
#define SIZE 4096 
int main()
{
  
    key_t key=ftok(pathname,number); //第二位参数必须是 8位无符号整数
    if(key<0)
    {
        perror("client create key failed");
        return 1;
    }
    int shm=shmget(key,SIZE,IPC_CREAT|0666);
    if(shm<0)
    {
        perror("create shm failed");
        return 2;
    }
    char* msg=(char*)shmat(shm,NULL,0);
    printf("please Enter: ");
    fflush(stdout);
    read(0,msg,SIZE);
    shmdt(msg);
    return 0;
}